summaryrefslogtreecommitdiff
path: root/src/pages/posts/[slug].astro
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages/posts/[slug].astro')
-rw-r--r--src/pages/posts/[slug].astro19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pages/posts/[slug].astro b/src/pages/posts/[slug].astro
new file mode 100644
index 0000000..0f29ec5
--- /dev/null
+++ b/src/pages/posts/[slug].astro
@@ -0,0 +1,19 @@
+---
+import { getCollection, type CollectionEntry } from 'astro:content';
+import PostLayout from '../../layouts/PostLayout.astro';
+
+export async function getStaticPaths() {
+ const posts = await getCollection('posts');
+ return posts.map((post: CollectionEntry<'posts'>) => ({
+ params: { slug: post.slug },
+ props: { post },
+ }));
+}
+
+const { post } = Astro.props as { post: CollectionEntry<'posts'> };
+const { Content } = await post.render();
+---
+
+<PostLayout title={post.data.title}>
+ <Content />
+</PostLayout>